// src/requireComponent.js
const requireComponent = {};

const componentsContext = require.context('../../components', true, /\.vue$/);

componentsContext.keys().forEach((file) => {  
  const componentConfig = componentsContext(file);  
  const componentName = file    
    .split('/')    
    .pop()    
    .replace(/\.vue$/, ''); // 移除文件名中的.vue后缀

  requireComponent[componentName] = componentConfig.default || componentConfig;
});

export default requireComponent;